#include <iostream>
using namespace std;
typedef struct node{
    int value;
    node *left;
    node *right;  
}node;

int isAVL(node *root){//如果是AVL树，则返回高度，否则返回-1
    if (root==NULL) return 0;
    int rightheight=0, leftheight=0;
    if (root->left!=NULL){
        leftheight=isAVL(root->left);
    }
    if (root->right!=NULL){
        rightheight=isAVL(root->right);
    }
    if (leftheight==-1||rightheight==-1) return -1;
    if (abs(leftheight-rightheight)>1) return -1;
    return max(leftheight,rightheight)+1;
}


int main(){
    node root;
    int isAVLorNot=isAVL(&root);
    if (isAVLorNot==-1){
        cout<<"The tree is not AVL."<<endl;
    }
    else{
        cout<<"The tree is AVL."<<endl;
    }
    return 0;
}